package com.kabigon.tiny.service.impl;

import com.kabigon.tiny.domain.sysuser.SysUser;
import com.kabigon.tiny.mapper.sysuser.SysUserMapper;
import com.kabigon.tiny.service.UserService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author kabigon
 * @version 2022/12/4/20:13
 */
@Service("userService")
public class UserServiceImpl implements UserService, InitializingBean {

    private SysUserMapper sysUserMapper;

    @Autowired
    public void setSysUserMapper(SysUserMapper sysUserMapper) {
        this.sysUserMapper = sysUserMapper;
    }

    @Override
    public void show() {
        List<SysUser> all = sysUserMapper.findAll();
        for (SysUser sysUser : all) {
            System.out.println(sysUser);
        }
    }

    //private UserDao userDao;

    //public UserServiceImpl() {
    //    System.out.println("UserServiceImpl 实例化");
    //}

    /*public void setUserDao(UserDaoImpl userDao) {
        System.out.println("setUserDao");
        this.userDao = userDao;
    }*/

    public void init() {
        System.out.println("userService 实例初始化");
    }

    public void destroy() {
        System.out.println("userService 实例销毁");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet 执行...");
    }


}
